//
//  DemoViewController.m
//  UIView及子类构造函数
//
//  Created by lantaiyuan on 2017/8/19.
//  Copyright © 2017年 lantaiyuan. All rights reserved.
//

#import "DemoViewController.h"

@interface DemoViewController ()
@property(nonatomic,strong)UILabel *label;

@end

@implementation DemoViewController
-(UILabel *)label{
    
    //label 为nil,就会创建
    if (!_label) {
        _label = [[UILabel alloc]init];
        _label.text  = @"self label";
        [_label sizeToFit];
        _label.center = self.view.center;
    }
    return _label;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view addSubview:self.label];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    //ios6之后不会再清理视图，视图会始终保留
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
